home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Shareware / Mockups for Desktop 1.5.27 / MockupsForDesktop.air / MockupsAir.swf / scripts / Activate.as < prev    next >
Encoding:
Text File  |  2009-03-03  |  12.2 KB  |  346 lines

  1. package
  2. {
  3.    import com.plus9.mockups.InputManager;
  4.    import com.plus9.mockups.dialogs.BaseDialog;
  5.    import com.plus9.mockups.ui.OKCancel;
  6.    import flash.accessibility.*;
  7.    import flash.data.*;
  8.    import flash.debugger.*;
  9.    import flash.desktop.*;
  10.    import flash.display.*;
  11.    import flash.errors.*;
  12.    import flash.events.*;
  13.    import flash.external.*;
  14.    import flash.filesystem.*;
  15.    import flash.filters.*;
  16.    import flash.geom.*;
  17.    import flash.html.*;
  18.    import flash.html.script.*;
  19.    import flash.media.*;
  20.    import flash.net.*;
  21.    import flash.printing.*;
  22.    import flash.profiler.*;
  23.    import flash.system.*;
  24.    import flash.text.*;
  25.    import flash.ui.*;
  26.    import flash.utils.*;
  27.    import flash.xml.*;
  28.    import mx.binding.*;
  29.    import mx.containers.ControlBar;
  30.    import mx.containers.Form;
  31.    import mx.containers.FormItem;
  32.    import mx.containers.HBox;
  33.    import mx.controls.Label;
  34.    import mx.controls.LinkButton;
  35.    import mx.controls.Text;
  36.    import mx.controls.TextInput;
  37.    import mx.core.UIComponentDescriptor;
  38.    import mx.core.mx_internal;
  39.    import mx.events.PropertyChangeEvent;
  40.    import mx.styles.*;
  41.    
  42.    public class Activate extends BaseDialog
  43.    {
  44.       public var toDoNext:String;
  45.       
  46.       protected var _storageManager:StorageManagerAir;
  47.       
  48.       private var _91108202_name:TextInput;
  49.       
  50.       private var _1541307179_okCancel:OKCancel;
  51.       
  52.       private var _2936224_key:TextInput;
  53.       
  54.       private var _981817656_message:Text;
  55.       
  56.       private var _documentDescriptor_:UIComponentDescriptor;
  57.       
  58.       protected var _1892748927CheckIcon:Class;
  59.       
  60.       public function Activate()
  61.       {
  62.          _documentDescriptor_ = new UIComponentDescriptor({
  63.             "type":BaseDialog,
  64.             "propertiesFactory":function():Object
  65.             {
  66.                return {
  67.                   "height":288,
  68.                   "childDescriptors":[new UIComponentDescriptor({
  69.                      "type":Text,
  70.                      "id":"_message",
  71.                      "stylesFactory":function():void
  72.                      {
  73.                         this.left = "5";
  74.                         this.right = "5";
  75.                         this.top = "5";
  76.                      },
  77.                      "propertiesFactory":function():Object
  78.                      {
  79.                         return {
  80.                            "selectable":false,
  81.                            "height":87
  82.                         };
  83.                      }
  84.                   }),new UIComponentDescriptor({
  85.                      "type":Form,
  86.                      "stylesFactory":function():void
  87.                      {
  88.                         this.horizontalCenter = "0";
  89.                         this.bottom = "0";
  90.                      },
  91.                      "propertiesFactory":function():Object
  92.                      {
  93.                         return {"childDescriptors":[new UIComponentDescriptor({
  94.                            "type":FormItem,
  95.                            "propertiesFactory":function():Object
  96.                            {
  97.                               return {
  98.                                  "label":"Your full name:",
  99.                                  "childDescriptors":[new UIComponentDescriptor({
  100.                                     "type":HBox,
  101.                                     "propertiesFactory":function():Object
  102.                                     {
  103.                                        return {"childDescriptors":[new UIComponentDescriptor({
  104.                                           "type":TextInput,
  105.                                           "id":"_name",
  106.                                           "events":{"change":"___name_change"},
  107.                                           "propertiesFactory":function():Object
  108.                                           {
  109.                                              return {"width":144};
  110.                                           }
  111.                                        }),new UIComponentDescriptor({
  112.                                           "type":Label,
  113.                                           "propertiesFactory":function():Object
  114.                                           {
  115.                                              return {
  116.                                                 "text":"paste it from your email receipt, case sensitive",
  117.                                                 "width":256
  118.                                              };
  119.                                           }
  120.                                        })]};
  121.                                     }
  122.                                  })]
  123.                               };
  124.                            }
  125.                         }),new UIComponentDescriptor({
  126.                            "type":FormItem,
  127.                            "propertiesFactory":function():Object
  128.                            {
  129.                               return {
  130.                                  "label":"Serial Key:",
  131.                                  "childDescriptors":[new UIComponentDescriptor({
  132.                                     "type":TextInput,
  133.                                     "id":"_key",
  134.                                     "events":{"change":"___key_change"},
  135.                                     "propertiesFactory":function():Object
  136.                                     {
  137.                                        return {"width":380};
  138.                                     }
  139.                                  })]
  140.                               };
  141.                            }
  142.                         }),new UIComponentDescriptor({
  143.                            "type":FormItem,
  144.                            "propertiesFactory":function():Object
  145.                            {
  146.                               return {"childDescriptors":[new UIComponentDescriptor({
  147.                                  "type":LinkButton,
  148.                                  "events":{"click":"___Activate_LinkButton1_click"},
  149.                                  "propertiesFactory":function():Object
  150.                                  {
  151.                                     return {"label":"where can I find my serial key?"};
  152.                                  }
  153.                               })]};
  154.                            }
  155.                         })]};
  156.                      }
  157.                   }),new UIComponentDescriptor({
  158.                      "type":ControlBar,
  159.                      "stylesFactory":function():void
  160.                      {
  161.                         this.horizontalAlign = "right";
  162.                      },
  163.                      "propertiesFactory":function():Object
  164.                      {
  165.                         return {
  166.                            "height":50,
  167.                            "childDescriptors":[new UIComponentDescriptor({
  168.                               "type":OKCancel,
  169.                               "id":"_okCancel",
  170.                               "events":{
  171.                                  "close":"___okCancel_close",
  172.                                  "cancel":"___okCancel_cancel"
  173.                               },
  174.                               "propertiesFactory":function():Object
  175.                               {
  176.                                  return {"okLabel":"Activate"};
  177.                               }
  178.                            })]
  179.                         };
  180.                      }
  181.                   })]
  182.                };
  183.             }
  184.          });
  185.          _1892748927CheckIcon = Activate_CheckIcon;
  186.          super();
  187.          mx_internal::_document = this;
  188.          this.height = 288;
  189.          this.title = "Product Activation";
  190.       }
  191.       
  192.       [Bindable(event="propertyChange")]
  193.       protected function get CheckIcon() : Class
  194.       {
  195.          return this._1892748927CheckIcon;
  196.       }
  197.       
  198.       protected function set CheckIcon(param1:Class) : void
  199.       {
  200.          var _loc2_:Object = this._1892748927CheckIcon;
  201.          if(_loc2_ !== param1)
  202.          {
  203.             this._1892748927CheckIcon = param1;
  204.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"CheckIcon",_loc2_,param1));
  205.          }
  206.       }
  207.       
  208.       public function ___okCancel_cancel(param1:Event) : void
  209.       {
  210.          onCancel();
  211.       }
  212.       
  213.       public function ___name_change(param1:Event) : void
  214.       {
  215.          updateActivateEnabledState();
  216.       }
  217.       
  218.       public function set _key(param1:TextInput) : void
  219.       {
  220.          var _loc2_:Object = this._2936224_key;
  221.          if(_loc2_ !== param1)
  222.          {
  223.             this._2936224_key = param1;
  224.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_key",_loc2_,param1));
  225.          }
  226.       }
  227.       
  228.       [Bindable(event="propertyChange")]
  229.       public function get _message() : Text
  230.       {
  231.          return this._981817656_message;
  232.       }
  233.       
  234.       protected function updateActivateEnabledState() : void
  235.       {
  236.          var _loc1_:Boolean = _storageManager.isValidKey(_name.text,_key.text);
  237.          _okCancel.enableOK = _loc1_;
  238.          _okCancel.okBtn.setStyle("icon",_loc1_ ? CheckIcon : null);
  239.          if(_okCancel.enableOK)
  240.          {
  241.             defaultButton = _okCancel.okBtn;
  242.             _okCancel.okBtn.setFocus();
  243.          }
  244.          else
  245.          {
  246.             defaultButton = _okCancel.cancelBtn;
  247.          }
  248.       }
  249.       
  250.       public function ___key_change(param1:Event) : void
  251.       {
  252.          updateActivateEnabledState();
  253.       }
  254.       
  255.       override public function init(param1:InputManager) : void
  256.       {
  257.          super.init(param1);
  258.          defaultButton = _okCancel.cancelBtn;
  259.          _name.setFocus();
  260.          _message.text = "This feature is only available to paying customers.\n\nIf you bought a copy of Balsamiq Mockups please enter your full name or organization name and serial key below to activate Mockups For Desktop.";
  261.       }
  262.       
  263.       public function set _name(param1:TextInput) : void
  264.       {
  265.          var _loc2_:Object = this._91108202_name;
  266.          if(_loc2_ !== param1)
  267.          {
  268.             this._91108202_name = param1;
  269.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_name",_loc2_,param1));
  270.          }
  271.       }
  272.       
  273.       [Bindable(event="propertyChange")]
  274.       public function get _okCancel() : OKCancel
  275.       {
  276.          return this._1541307179_okCancel;
  277.       }
  278.       
  279.       override public function initialize() : void
  280.       {
  281.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  282.          super.initialize();
  283.       }
  284.       
  285.       [Bindable(event="propertyChange")]
  286.       public function get _key() : TextInput
  287.       {
  288.          return this._2936224_key;
  289.       }
  290.       
  291.       public function ___Activate_LinkButton1_click(param1:MouseEvent) : void
  292.       {
  293.          onHelpClick(param1);
  294.       }
  295.       
  296.       public function set storageManager(param1:StorageManagerAir) : void
  297.       {
  298.          _storageManager = param1;
  299.          updateActivateEnabledState();
  300.       }
  301.       
  302.       [Bindable(event="propertyChange")]
  303.       public function get _name() : TextInput
  304.       {
  305.          return this._91108202_name;
  306.       }
  307.       
  308.       public function ___okCancel_close(param1:Event) : void
  309.       {
  310.          onActivate();
  311.       }
  312.       
  313.       protected function onHelpClick(param1:MouseEvent) : void
  314.       {
  315.          navigateToURL(new URLRequest("http://www.balsamiq.com/products/mockups/support"));
  316.       }
  317.       
  318.       public function set _okCancel(param1:OKCancel) : void
  319.       {
  320.          var _loc2_:Object = this._1541307179_okCancel;
  321.          if(_loc2_ !== param1)
  322.          {
  323.             this._1541307179_okCancel = param1;
  324.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_okCancel",_loc2_,param1));
  325.          }
  326.       }
  327.       
  328.       protected function onActivate() : void
  329.       {
  330.          _inputManager.dialogIsOpen = false;
  331.          dispatchEvent(new Event("myActivate"));
  332.       }
  333.       
  334.       public function set _message(param1:Text) : void
  335.       {
  336.          var _loc2_:Object = this._981817656_message;
  337.          if(_loc2_ !== param1)
  338.          {
  339.             this._981817656_message = param1;
  340.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_message",_loc2_,param1));
  341.          }
  342.       }
  343.    }
  344. }
  345.  
  346.